﻿@{
    var token = GitCandy.Security.Token.Current;
    var cfg = NewLife.Common.SysConfig.Current;
    var title = ViewBag.Title + "";
    if (title != "" && !title.EndsWith(" - ")) { title += " - "; }
    title += cfg.DisplayName;
    var title2 = ViewBag.Title2 as String;
    if (!title2.IsNullOrEmpty()) { title += " - " + title2; }
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="@ViewBag.Lang">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@title</title>
    <link rel="stylesheet" href="~/Content/bootstrap.css" />
    <link rel="stylesheet" href="~/Content/bootstrap-switch.css" />
    <link rel="stylesheet" href="~/Content/highlight.css" />
    <link rel="stylesheet" href="~/Content/site.css" />
</head>
<body>
    <div class="navbar navbar-default">
        <div class="container">
            <div class="navbar-header">
                <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".navbar-responsive-collapse">
                    <span class="sr-only"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="~/">@cfg.DisplayName<sub>@cfg.Name</sub></a>
            </div>
            <div class="navbar-collapse collapse navbar-responsive-collapse">
                <ul class="nav navbar-nav">
                    <li>@Html.ActionLink(SR.Shared_Repositories, "Index", "Repository")</li>
                    @if (token != null)
                    {
                        if (token.IsAdmin)
                        {
                            <li class="">@Html.ActionLink(SR.Shared_Users, "Index", "Account")</li>
                            <li class="">@Html.ActionLink(SR.Shared_Teams, "Index", "Team")</li>
                            <li class="">@Html.ActionLink(SR.Shared_Settings, "Index", "GitCandy/Git")</li>
                            <li class="">@Html.ActionLink("控制台", "Index", "Admin")</li>
                        }
                        <li class="">@Html.ActionLink("创建项目", "Create", "Repository")</li>
                    }
                    <li>@Html.ActionLink(SR.Shared_About, "About", "Home")</li>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    @if (token == null)
                    {
                        <li class="">@Html.ActionLink(SR.Shared_Register, "Create", "Account")</li>
                        <li class="">@Html.ActionLink(SR.Shared_Login, "Login", "Account", new { ReturnUrl = ViewContext.HttpContext.Request.Url.PathAndQuery }, null)</li>
                    }
                    else
                    {
                        <li class="">@Html.ActionLink(token.Nickname, "Detail", "Account", new { name = token.Username }, null)</li>
                        <li class="">@Html.ActionLink(SR.Shared_Logout, "Logout", "Account", new { ReturnUrl = ViewContext.HttpContext.Request.Url.PathAndQuery }, null)</li>
                    }
                </ul>
            </div>
        </div>
    </div>

    <div class="container">
        @RenderBody()
    </div>

    <div class="container footer">
        <div class="page-divider"></div>
        <div class="clearfix">
            <div class="pull-right btn-group dropup">
                <a class="dropdown-toggle" data-toggle="dropdown" href="#">@ViewBag.Language <span class="caret"></span></a>
                <ul class="dropdown-menu">
                    <li>@Html.CultureActionLink("zh-cn")</li>
                    <li>@Html.CultureActionLink("en-us")</li>
                    <li>@Html.CultureActionLink("fr-fr")</li>
                </ul>
            </div>
            <div class="pull-left"><p class="muted" title="@Profiler.Current.Elapsed">&copy; 2002-@DateTime.Now.Year @cfg.Company</p></div>
        </div>
    </div>

    <script src="~/Scripts/jquery-2.0.3.js"></script>
    <script src="~/Scripts/bootstrap.js"></script>
    <script src="~/Scripts/bootstrap-switch.js"></script>
    <script src="~/Scripts/bootstrap3-typeahead.js"></script>
    <script src="~/Scripts/highlight.pack.js"></script>
    <script src="~/Scripts/marked.js"></script>
    <script src="~/Scripts/common.js"></script>
    @RenderSection("scripts", required: false)
</body>
</html>
